
package org.demo.springbootdemo.Common;

public class Response {
    private Integer code;
    private String message;
    private Object data;

    public Response() {
    }

    public Response(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static Response success() {
        return new Response(200, "success", null);
    }

    public static Response success(Object data) {
        return new Response(200, "success", data);
    }

    public static Response success(String message, Object data) {
        return new Response(200, message, data);
    }

    public static Response error() {
        return new Response(500, "error", null);
    }

    public static Response error(String message) {
        return new Response(500, message, null);
    }

    public static Response error(Integer code, String message) {
        return new Response(code, message, null);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}